/*  1:   */ package org.jetbrains.generate.tostring.config;
/*  2:   */ 
/*  3:   */

import com.intellij.openapi.editor.Editor;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiMethod;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */ 
/*  9:   */ public class ReplacePolicy
/* 10:   */   implements ConflictResolutionPolicy
/* 11:   */ {
/* 12:29 */   private static final ReplacePolicy a = new ReplacePolicy();
/* 13:   */   
/* 14:   */   public static ReplacePolicy getInstance()
/* 15:   */   {
/* 16:35 */     return a;
/* 17:   */   }
/* 18:   */   
/* 19:   */   public void setNewMethodStrategy(InsertNewMethodStrategy paramInsertNewMethodStrategy)
/* 20:   */   {
/* 21:39 */     DuplicatePolicy.getInstance().setNewMethodStrategy(paramInsertNewMethodStrategy);
/* 22:   */   }
/* 23:   */   
/* 24:   */   public PsiMethod applyMethod(PsiClass paramPsiClass, PsiMethod paramPsiMethod1, @NotNull PsiMethod paramPsiMethod2, Editor paramEditor)
/* 25:   */     throws IncorrectOperationException
/* 26:   */   {
/* 27:43 */     if (paramPsiMethod2 == null) {
/* 28:43 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "2", "org/jetbrains/generate/tostring/config/ReplacePolicy", "applyMethod" }));
/* 29:   */     }
/* 30:43 */     PsiMethod localPsiMethod = DuplicatePolicy.getInstance().applyMethod(paramPsiClass, null, paramPsiMethod2, paramEditor);
/* 31:44 */     if (paramPsiMethod1 != null) {
/* 32:45 */       paramPsiMethod1.delete();
/* 33:   */     }
/* 34:47 */     return localPsiMethod;
/* 35:   */   }
/* 36:   */   
/* 37:   */   public String toString()
/* 38:   */   {
/* 39:51 */     return "Replace existing";
/* 40:   */   }
/* 41:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.jetbrains.generate.tostring.config.ReplacePolicy

 * JD-Core Version:    0.7.0.1

 */